import { baseURL } from "./config"

export default function request(options) {
  if (!options) return null;
  return new Promise((resolve, reject) => {
    wx.request({
      url: baseURL + options.url,
      method: options.method || "GET",
      data: options.data || {},
      success: resolve,
      fail: reject,
    });
  });
}